{# Template fragment for comparing two runs. #}
<h3>摘要</h3>
<table class="table table-striped">
    <thead>
        <tr>
            <th>&nbsp;</th>
            <th class="right">调用函数数量</th>
            <th class="right">包含执行时间</th>
            <th class="right">包含CPU时间</th>
            <th class="right">包含内存占用</th>
            <th class="right">包含内存占用峰值</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>
                <span class="badge compare-base">
                    基础 - {{ comparison.base.date|date(date_format) }}
                </span>
                <a target="_blank" href="{{ url('run.view', {id: comparison.base.id|trim}) }}">
                    {{ comparison.base.id }}
                </a>
            </th>
            <td class="right">{{ comparison.base.functionCount }}</td>
            <td class="right">{{ comparison.base.get('main()', 'wt') |as_time }}</td>
            <td class="right">{{ comparison.base.get('main()', 'cpu') |as_time }}</td>
            <td class="right">{{ comparison.base.get('main()', 'mu') |as_bytes }}</td>
            <td class="right">{{ comparison.base.get('main()', 'pmu') |as_bytes }}</td>
        </tr>
        <tr>
            <th>
                <span class="badge compare-head">
                    新 - {{ comparison.head.date|date(date_format) }}
                </span>
                <a target="_blank" href="{{ url('run.view', {id: comparison.head.id|trim}) }}">
                    {{ comparison.head.id }}
                </a>
            </th>
            <td class="right">{{ comparison.head.functionCount }}</td>
            <td class="right">{{ comparison.head.get('main()', 'wt') |as_time }}</td>
            <td class="right">{{ comparison.head.get('main()', 'cpu') |as_time }}</td>
            <td class="right">{{ comparison.head.get('main()', 'mu') |as_bytes }}</td>
            <td class="right">{{ comparison.head.get('main()', 'pmu') |as_bytes }}</td>
        </tr>
        <tr>
            <th>差异</th>
            <td class="right">{{ comparison.diff.functionCount }}</td>
            <td class="right">{{ comparison.diff['main()'].wt|as_time }}</td>
            <td class="right">{{ comparison.diff['main()'].cpu|as_time }}</td>
            <td class="right">{{ comparison.diff['main()'].mu|as_bytes }}</td>
            <td class="right">{{ comparison.diff['main()'].pmu|as_bytes }}</td>
        </tr>
        <tr>
            <th>差异 %</th>
            <td class="right">{{ comparison.diffPercent.functionCount|as_percent }}</td>
            <td class="right">{{ comparison.diffPercent['main()'].wt|as_percent }}</td>
            <td class="right">{{ comparison.diffPercent['main()'].cpu|as_percent }}</td>
            <td class="right">{{ comparison.diffPercent['main()'].mu|as_percent }}</td>
            <td class="right">{{ comparison.diffPercent['main()'].pmu|as_percent }}</td>
        </tr>
    </tbody>
</table>


<div class="pull-right form-search">
  <input type="search" id="function-filter" placeholder="根据函数过滤" />
</div>

<h3>详细</h3>

<table class="table table-hover table-sort" id="filter-table">
    <thead>
        <tr>
            <th>函数</th>
            <th>调用次数</th>
            <th>自身执行时间</th>
            <th>自身CPU时间</th>
            <th>自身内存占用</th>
            <th>自身内存占用峰值</th>
            <th>包含执行时间</th>
            <th>包含CPU时间</th>
            <th>包含内存占用</th>
            <th>包含内存占用峰值</th>
        </tr>
    </thead>
    <tbody>
        {% for key, value in comparison.diff %}
        <tr>
            <td class="text">
                <a href="{{ url('run.symbol', {'id': comparison.head.id|trim, 'symbol': key}) }}">{{ key }}</a>
            </td>
            <td class="right">{{ value.ct|as_diff }}</td>
            <td class="right">{{ value.ewt|as_diff }}</td>
            <td class="right">{{ value.ecpu|as_diff }}</td>
            <td class="right">{{ value.emu|as_diff }}</td>
            <td class="right">{{ value.epmu|as_diff }}</td>
            <td class="right">{{ value.wt|as_diff }}</td>
            <td class="right">{{ value.cpu|as_diff }}</td>
            <td class="right">{{ value.mu|as_diff }}</td>
            <td class="right">{{ value.pmu|as_diff }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>
<p>Red values are higher in 'new'. Green values are lower in 'new'.</p>
